<template>
  <section class="jumbotron">
    <h3 class="jumbotron-heading">Search Github Users</h3>
    <div>
      <input type="text" placeholder="enter the name you search" v-model="keyword"/>
      <button @click="search">Search</button>
    </div>
  </section>
</template>

<script>
export default {
  name: 'SearchHeader',
  data () {
    return {
      keyword: ''
    }
  },
  methods: {
    search () {
      // 如果有输入, 通过总线分发search事件
      if (this.keyword) {
        this.$bus.$emit('search', this.keyword)
      }
    }
  }
}
</script>

<style scoped>

</style>
